home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / JQO0P4 (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  1.8 KB  |  45 lines

  1. package java.io;
  2.  
  3. class ObjectStreamField {
  4.    String name;
  5.    char type;
  6.    int offset;
  7.    String typeString;
  8.  
  9.    ObjectStreamField() {
  10.    }
  11.  
  12.    ObjectStreamField(String n, char t, int o, String ts) {
  13.       this.name = n;
  14.       this.type = t;
  15.       this.offset = o;
  16.       this.typeString = ts;
  17.    }
  18.  
  19.    int compare(ObjectStreamField other) {
  20.       boolean thisprim = this.typeString == null;
  21.       boolean otherprim = other.typeString == null;
  22.       if (thisprim != otherprim) {
  23.          return thisprim ? -1 : 1;
  24.       } else {
  25.          return this.name.compareTo(other.name);
  26.       }
  27.    }
  28.  
  29.    boolean isPrimitive() {
  30.       return this.type != '[' && this.type != 'L';
  31.    }
  32.  
  33.    public String toString() {
  34.       return this.typeString != null ? this.typeString + " " + this.name + " @" + this.offset : this.type + " " + this.name + " @" + this.offset;
  35.    }
  36.  
  37.    boolean typeEquals(ObjectStreamField other) {
  38.       if (other != null && this.type == other.type) {
  39.          return this.typeString == null && other.typeString == null ? true : ObjectStreamClass.compareClassNames(this.typeString, other.typeString, '/');
  40.       } else {
  41.          return false;
  42.       }
  43.    }
  44. }
  45.